<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>数据权限统一设置</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-first">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>权限统一设置为</label>
                        <div class="layui-input-block">
                            <select id="dataauth" name="dataauth" lay-filter="dataauth" ></select>
                            <p class="error" id="dataauth_error" style="margin: 0;"></p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</form>
<script>

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        var dataAuth = parent.dataAuth;

        var tongStr = '<option value="">请选择</option>';
        for (var key in dataAuth){
            tongStr += '<option value="'+key+'">'+dataAuth[key]+'</option>';
        }
        $("#dataauth").html(tongStr);
        render_from()


        form.on('select(dataauth)', function(data){
            if(data.value == ''){
                $('#dataauth_error').show().text('请选择');
                $('#dataauth_error').parent().find('input').addClass('select_error');
            }else{
                $('#dataauth_error').hide();
                $('#dataauth_error').parent().find('input').removeClass('select_error');
            }
        });

        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();
            if(data.field.dataauth == ''){
                $('#dataauth_error').show().text('请选择');
                $('#dataauth_error').parent().find('input').addClass('select_error');
                validRes = false;
            }else{
                $('#dataauth_error').hide();
                $('#dataauth_error').parent().find('input').removeClass('select_error');
            }
            if(!validRes){return false;}


            $(".trdataauth", parent.document).val(data.field.dataauth);
            parent.render_from();

            layer_close();
            return false;
        });

    });




</script>
</body>
</html>
